package com.jsoft.jsofted.sys.mapper;

import com.diboot.core.mapper.BaseCrudMapper;
import com.jsoft.jsofted.sys.entity.OrgGroupEntity;
import com.jsoft.jsofted.sys.vo.OrgGroupView;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GroupMapper extends BaseCrudMapper<OrgGroupEntity> {

    @Select("SELECT g.*, o.name as name, o.full_name as fullName, o.parent_id as parentId, o.type as type " +
            "FROM sys_group g JOIN sys_org o ON g.id = o.id WHERE g.members like #{userId}")
    List<OrgGroupView> queryGroupViewByUserId(String userId);

}
